/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package muddb.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 *
 * @author keith
 */
@Entity
@Table( name = "equipped_loc" )
@NamedQueries( { @NamedQuery( name = "EquippedLoc.findByEquippedLocId", query =
                                                                        "SELECT e FROM EquippedLoc e WHERE e.equippedLocId = :equippedLocId" ),
                 @NamedQuery( name = "EquippedLoc.findByEquippedLocName", query =
                                                                          "SELECT e FROM EquippedLoc e WHERE e.equippedLocName = :equippedLocName" ) } )
public class EquippedLoc implements Serializable {
  private static final long serialVersionUID = 1L;
  @Id
  @GeneratedValue( strategy=GenerationType.SEQUENCE )
  @Column( name = "equipped_loc_id", nullable = false )
  private Integer equippedLocId;
  @Column( name = "equipped_loc_name", nullable = false, length=20, unique=true )
  private String equippedLocName;
  @OneToMany( mappedBy = "equippedLocId" )
  private Collection<UserCharItem> userCharItemCollection;


  public EquippedLoc() {
  }


  public EquippedLoc( Integer equippedLocId ) {
    this.equippedLocId = equippedLocId;
  }


  public EquippedLoc( Integer equippedLocId, String equippedLocName ) {
    this.equippedLocId = equippedLocId;
    this.equippedLocName = equippedLocName;
  }


  public Integer getEquippedLocId() {
    return equippedLocId;
  }


  public void setEquippedLocId( Integer equippedLocId ) {
    this.equippedLocId = equippedLocId;
  }


  public String getEquippedLocName() {
    return equippedLocName;
  }


  public void setEquippedLocName( String equippedLocName ) {
    this.equippedLocName = equippedLocName;
  }


  public Collection<UserCharItem> getUserCharItemCollection() {
    return userCharItemCollection;
  }


  public void setUserCharItemCollection( Collection<UserCharItem> userCharItemCollection ) {
    this.userCharItemCollection = userCharItemCollection;
  }


  @Override
  public int hashCode() {
    int hash = 0;
    hash += ( equippedLocId != null ? equippedLocId.hashCode() : 0 );
    return hash;
  }


  @Override
  public boolean equals( Object object ) {
    // TODO: Warning - this method won't work in the case the id fields are not set
    if ( !( object instanceof EquippedLoc ) ) {
      return false;
    }
    EquippedLoc other = (EquippedLoc) object;
    if ( ( this.equippedLocId == null && other.equippedLocId != null ) || ( this.equippedLocId != null && !this.equippedLocId.equals( other.equippedLocId ) ) ) {
      return false;
    }
    return true;
  }


  @Override
  public String toString() {
    return "muddb.entities.EquippedLoc[equippedLocId=" + equippedLocId + "]";
  }

}
